package com.ipt.frm.hola;

import javax.ws.rs.client.Client;
import javax.ws.rs.client.ClientBuilder;
import javax.ws.rs.client.WebTarget;
import javax.ws.rs.core.MediaType;

public class Test {
	public static void main(String[] args) {

		Client restClient = ClientBuilder.newClient();

		WebTarget target = restClient
				.target("http://localhost:8080/PruebaRestfullSM/");
		WebTarget resourceTarget = target.path("rest/hello/");

		String responseStringText = resourceTarget
				.request(MediaType.TEXT_PLAIN).get(String.class);
		System.out.println("Here is the response in PlainText: "
				+ responseStringText);

		String responseStringHTML = resourceTarget.request(MediaType.TEXT_HTML)
				.get(String.class);
		System.out.println("Here is the response in HTML: "
				+ responseStringHTML);

		String responseStringXML = resourceTarget.request(MediaType.TEXT_XML)
				.get(String.class);
		System.out.println("Here is the response in XML: " + responseStringXML);

		String responseStringJSON = resourceTarget.request(
				MediaType.APPLICATION_JSON).get(String.class);
		System.out.println("Here is the response in JSON: "
				+ responseStringJSON);
		/*
		 * String responseStringTextPost = resourceTarget.request(
		 * MediaType.TEXT_PLAIN).post(String.class);
		 * System.out.println("Here is the response in JSON: " +
		 * responseStringJSON);
		 */
	}
}